package StructuralPattern.AdapterPattern.ObjectAdapterPattern.adapter;

import StructuralPattern.AdapterPattern.ObjectAdapterPattern.Interfase.MediaPlayer;
import StructuralPattern.AdapterPattern.ObjectAdapterPattern.Mp4Player;
import StructuralPattern.AdapterPattern.ObjectAdapterPattern.VlcPlayer;
import StructuralPattern.AdapterPattern.ObjectAdapterPattern.Interfase.AdvancedMediaPlayer;

public class MediaAdapter implements  MediaPlayer {
    private AdvancedMediaPlayer advancedMediaPlayer;

    public MediaAdapter(String audioType) {
        if (audioType.equalsIgnoreCase("mp4")) {
            advancedMediaPlayer = new Mp4Player();
        } else if (audioType.equalsIgnoreCase("vlc")) {
            advancedMediaPlayer = new VlcPlayer();
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        if (audioType.equalsIgnoreCase("mp4")) {
            advancedMediaPlayer.playMp4(fileName);
        } else if (audioType.equalsIgnoreCase("vlc")) {
            advancedMediaPlayer.playVlc(fileName);
        }
    }
}